const express = require("express");
const app = express();
app.use(express.static(__dirname));
// 配置接收的请求体数据为JSON格式。
app.use(express.json());
// get
app.get("/info",(req,res)=>{
	res.json({
		ok:1,
		msg:"get->info->success"
	})
})
// delete
app.delete("/info",(req,res)=>{
	res.json({
		ok:1,
		msg:"delete->info->success"
	})
})
// post
app.post("/info",(req,res)=>{
	res.json({
		ok:1,
		msg:"post->info->success"
	})
})

app.post("/info2",(req,res)=>{
	// username age: application/json
	console.log(req.body);
	res.json({
		ok:1,
		msg:"post->info->success",
		...req.body
	})
})

app.listen(80,()=>{
	console.log("success");
})